#include<iostream>
#include<algorithm> 
using namespace std;

int main()
{
	int n,rank,result;
	int i,j;
	while(cin>>n)
	{
		int *a=new int[n];
		for(i=0;i<n;i++)cin>>a[i];
		std::sort(a,a+n);
		//for(i=0;i<n;i++)cout<<a[i]<<' ';
		//cout<<endl;
		cin>>rank;
		result=a[0];
		for(i=0,j=1;i<n,j<=rank;i++)if(a[i]>result)j++;
		cout<<a[i]<<endl;
		delete []a;
	}
	return 0;
}
